package cn.hahah.module.blog.dal.mysql.setting;

import java.util.*;

import cn.hahah.framework.common.pojo.PageResult;
import cn.hahah.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.hahah.framework.mybatis.core.mapper.BaseMapperX;
import cn.hahah.module.blog.dal.dataobject.setting.SettingDO;
import org.apache.ibatis.annotations.Mapper;
import cn.hahah.module.blog.controller.admin.setting.vo.*;

/**
 * 博客系统设置 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface SettingMapper extends BaseMapperX<SettingDO> {

    default PageResult<SettingDO> selectPage(SettingPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<SettingDO>()
                .eqIfPresent(SettingDO::getKeyEn, reqVO.getKeyEn())
                .eqIfPresent(SettingDO::getKeyZh, reqVO.getKeyZh())
                .eqIfPresent(SettingDO::getCreator, reqVO.getCreator())
                .betweenIfPresent(SettingDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(SettingDO::getId));
    }

}